<h2>守卫 <small><a [routerLink]="['/protected']">Protected</a></small></h2>

<!--未登录状态-->
<form class="form-inline" *ngIf="!authService.getUser()">
    <div class="form-group">
        <label for="username">User:</label>
        <input class="form-control" name="username" #username>
    </div>
    <div class="form-group">
        <label for="password">Password:</label>
        <input class="form-control" type="password" name="password" #password>
    </div>
    <a class="btn btn-default" (click)="login(username.value, password.value)">Submit</a>
</form>

<!--登录状态-->
<div class="well" *ngIf="authService.getUser()">
    登录用户名： <b>{{ authService.getUser() }}</b>
    <a href (click)="logout()">Log out</a>
</div>

<div class="alert alert-danger" role="alert" *ngIf="message">{{ message }}</div>